<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 联系人</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="__PUBLIC__/admin/favicon.ico">
    <link href="__PUBLIC__/admin/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/font-awesome.min.css?v=4.4.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/animate.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/css/style.css?v=4.1.0" rel="stylesheet">
    <link href="__PUBLIC__/admin/js/plugins/fancybox/jquery.fancybox.css" rel="stylesheet">
    <link href="__PUBLIC__/admin/js/plugins/iCheck/custom.css" rel="stylesheet">
    <!--<link href="__PUBLIC__/admin/js/layui/css/layui.css" rel="stylesheet">-->

</head>
<include file="Admin@Index:cache" />
<body class="gray-bg contacts" oncopy="copyval()">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox">
                <div class="ibox-content">
                    <h2>工作流控制</h2>

                    <br>
                    <table class="table table-striped table-hover">
                        <tbody>
                        <tr>
                            <th>商户号</th>
                            <th>终端客服状态</th>
                            <!--<th>审核员自动分配</th>-->
                            <!--<th>营销自动分配</th>-->
                            <th>淘宝认证</th>
                            <th>支付宝认证</th>
                            <th>信用卡认证</th>
                            <th>操作</th>
                        </tr>
                        <foreach name="list" item="list">
                            <tr>
                                <td><?= $list['merchant_name'];?></td>
                                <td><?= $list['terminal']=='1'?'启动':'停止';?></td>
                                <!--<td><?= $list['lender']=='1'?'启动':'停止';?></td>-->
                                <!--<td><?= $list['approver']=='1'?'启动':'停止';?></td>-->
                                <!--<td><?= $list['marketing']=='1'?'启动':'停止';?></td>-->
                                <td><?= $list['taobao']=='1'?'启动':'停止';?></td>
                                <td><?= $list['alipay']=='1'?'启动':'停止';?></td>
                                <td><?= $list['credit_card']=='1'?'启动':'停止';?></td>
                                <td>  <a class="btn btn-success btn-rounded modify" href="javascript:void(0);"
                                         onclick="upd_work_control('<{$list.id}>','<{$list.terminal}>','<{$list.approver}>','<{$list.marketing}>','<{$list.taobao}>','<{$list.alipay}>','<{$list.credit_card}>')">修改</a></td>
                            </tr>

                        </foreach>
                        </tbody>
                    </table>
                    <ul class="pagination">
                        <if condition="$tol gt 10">
                        <{$fpage}>
                            </if>
                    </ul>
                </div>
            </div>
        </div>
    </div>
</div>

<!-- 全局js -->
<script src="__PUBLIC__/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="__PUBLIC__/admin/js/bootstrap.min.js?v=3.3.6"></script>
<script src="__PUBLIC__/admin/js/layer/layer.js"></script>
<script src="__PUBLIC__/admin/js/layui/layui.js"></script>
<script src="__PUBLIC__/admin/js/layui/lay/modules/laydate.js"></script>
<!--<script src="__PUBLIC__/admin/js/layui/lay/dest/layui.all.js"></script>-->
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<script src="__PUBLIC__/admin/js/plugins/fancybox/jquery.fancybox.js"></script>

<script>
    $(document).ready(function () {
        $('.contact-box').each(function () {
            animationHover(this, 'pulse');
        });
    });

    function upd_work_control(id,tt,aa,mm,bb,alipay,credit_card) {
        var html = '';
        html += '<div class="modal-body" id="lists" style="height:100%">';
        html += '<form class="form-horizontal">';
        html += '<div class="form-group">';
        html += '<label class="col-sm-5 control-label" >终端客服状态：</label>';
        html += '<div class="col-sm-5">';
        html += '<select class="form-control m-b" name="tt" id="tt" style="height:3rem">';
        switch(tt){
            case '1':
                var a='selected';
                break;
            case '2':
                var b='selected';
                break;
        }
        html += '<option value="1" '+a+'>启动</option>';
        html += '<option value="2" '+b+'>停止</option>';
        html += '</select>';
        html += '</div>';
        html += '</div>';

        html += '<div class="form-group" style="display: none">';
        html += '<label class="col-sm-5 control-label" >审核员自动分配：</label>';
        html += '<div class="col-sm-5">';
        html += '<select class="form-control m-b" name="link_way" id="aa" style="height:3rem">';
        switch(aa){
            case '1':
                var e='selected';
                break;
            case '2':
                var f='selected';
                break;
        }
        html += '<option value="1" '+e+'>启动</option>';
        html += '<option value="2" '+f+'>停止</option>';
        html += '</select>';
        html += '</div>';
        html += '</div>';
        html += '<div class="form-group"  style="display: none">';
        html += '<label class="col-sm-5 control-label" >营销自动分配：</label>';
        html += '<div class="col-sm-5">';
        html += '<select class="form-control m-b" name="link_way" id="mm" style="height:3rem">';
        switch(mm){
            case '1':
                var g='selected';
                break;
            case '2':
                var h='selected';
                break;
        }
        html += '<option value="1" '+g+'>启动</option>';
        html += '<option value="2" '+h+'>停止</option>';
        html += '</select>';
        html += '</div>';
        html += '</div>';
        html += '<div class="form-group">';
        html += '<label class="col-sm-5 control-label" >淘宝认证：</label>';
        html += '<div class="col-sm-5">';
        html += '<select class="form-control m-b" name="taobao" id="bb" style="height:3rem">';
        switch(bb){
            case '1':
                var gg='selected';
                break;
            case '2':
                var hh='selected';
                break;
        }
        html += '<option value="1" '+gg+'>启动</option>';
        html += '<option value="2" '+hh+'>停止</option>';
        html += '</select>';
        html += '</div>';
        html += '</div>';
        html += '<div class="form-group">';
        html += '<label class="col-sm-5 control-label" >支付宝认证：</label>';
        html += '<div class="col-sm-5">';
        html += '<select class="form-control m-b" name="alipay" id="alipay" style="height:3rem">';
        switch(alipay){
            case '1':
                var ay='selected';
                break;
            case '2':
                var ays='selected';
                break;
        }
        html += '<option value="1" '+ay+'>启动</option>';
        html += '<option value="2" '+ays+'>停止</option>';
        html += '</select>';
        html += '</div>';
        html += '</div>';
        html += '<div class="form-group">';
        html += '<label class="col-sm-5 control-label" >信用卡认证：</label>';
        html += '<div class="col-sm-5">';
        html += '<select class="form-control m-b" name="credit_card" id="credit_card" style="height:3rem">';
        switch(credit_card){
            case '1':
                var ccd='selected';
                break;
            case '2':
                var ccds='selected';
                break;
        }
        html += '<option value="1" '+ccd+'>启动</option>';
        html += '<option value="2" '+ccds+'>停止</option>';
        html += '</select>';
        html += '</div>';
        html += '</div>';
        html += '</form>';
        html += '<div class="modal-footer" style="border:0">';
        html += '<a href="javascript:void(0);" onclick="layer.closeAll()" type="button" class="btn btn-default" >关闭</a>';
        html += '<a href="javascript:void(0);" onclick="upd_work_controls(\''+id+'\');" type="button" class="btn btn-primary" >修改</a>';
        html += '</div>';
        html += '</div>';

        layer.open({
            type: 1, //Page层类型
            area: ['500px', '490px'],
            title: '修改启动功能',
            shade: 0.6, //遮罩透明度
            maxmin: true, //允许全屏最小化
            anim: 1, //0-6的动画形式，-1不开启
            content: html
        });
    }


    function upd_work_controls(id) {
        layer.confirm('是否确定修改？', function () {
            layer.load(2);
            $.post('__MODULE__/Systems/upd_work_control', {
                id:id,
                tt: $('#tt').val(),
                aa: $('#aa').val(),
                mm: $('#mm').val(),
                bb: $('#bb').val(),
                alipay:$('#alipay').val(),
                credit_card:$('#credit_card').val()
            }, function (data) {
                layer.closeAll('loading');
                if (data.code == '1001') {
                    layer.closeAll();
                    layer.msg(data.result,{icon: 1,time:1000}, function(){
                        window.location.reload();
                    });
                } else {
                    if (data.status == '0') {
                        layer.msg(data.info, {time: 2000, icon: 5});
                    } else {
                        layer.msg(data.result, {time: 2000, icon: 5});
                    }
                }
            });
        });
    }

    function copyval() {
//        event.returnValue = false;
        var content = window.getSelection().toString();
        $.post('__MODULE__/Mypublic/copy_all', {content:content}, function (data) {
            if (data.code == '1001') {
            } else {
                console.log(data);
            }
        });
//        console.log(content)
    }

</script>


</body>

</html>
